﻿
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ListEstates.aspx.cs" Inherits="RealEstateCenter.ListEstates" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div id="add_estate_link" runat=server style="text-align:center; font-weight:bold;"><a href="AddEstate.aspx">Add Estate</a></div><br />
    <div id="search_estate_link" runat=server style="text-align:center; font-weight:bold;"><a href="SearchEstate.aspx">Search Estate</a></div><br />
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        AllowPaging="True" AllowSorting="True"
        DataKeyNames="estate_id"
        BorderStyle="Solid" PageSize="50" GridLines="None" 
        HorizontalAlign="Center">
        <AlternatingRowStyle BackColor="#CCCCCC" />
        <Columns>
            <asp:BoundField DataField="estate_id" HeaderText="Estate No" 
                InsertVisible="False" ReadOnly="True" SortExpression="estate_id" />
            <asp:BoundField DataField="estate_address" HeaderText="Estate Address" 
                SortExpression="estate_address" />
            <asp:BoundField DataField="estate_city" HeaderText="Estate City" 
                SortExpression="estate_city" />
            <asp:BoundField DataField="estate_room_number" HeaderText="Estate Room Number" 
                SortExpression="estate_room_number" />
            <asp:BoundField DataField="estate_heating_type" HeaderText="Estate Heating Type" 
                SortExpression="estate_heating_type" />
            <asp:BoundField DataField="estate_type" HeaderText="Estate Type" 
                SortExpression="estate_type" />
            <asp:BoundField DataField="estate_price" HeaderText="Estate Price" 
                SortExpression="estate_price" />
            <asp:HyperLinkField DataNavigateUrlFields="estate_id" HeaderText="" Text="Show Estate"
                 DataNavigateUrlFormatString="ShowEstate.aspx?id={0}" NavigateUrl="ShowEstate.aspx" />                 
            <asp:HyperLinkField DataNavigateUrlFields="estate_id" HeaderText="" Text="Edit Estate"
                 DataNavigateUrlFormatString="EditEstate.aspx?id={0}" NavigateUrl="EditEstate.aspx" />
            <asp:TemplateField HeaderText="">
                <ItemTemplate>
                <div style="text-align:center; width:50px;">
                    <asp:LinkButton ID="lnkdelete" runat="server" OnClick="lnkdelete_Click" >
                    <asp:Image ID="Image1" ImageUrl="~/deletebutton.gif" runat="server" ImageAlign="Middle" />
                    </asp:LinkButton></div>
                </ItemTemplate>
            </asp:TemplateField>

        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\RealEstateCenter.mdf;Integrated Security=True;User Instance=True" 
        ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM [Estate]">
    </asp:SqlDataSource>
</asp:Content>

